package com.ruoyi.merchant.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.merchant.domain.PmsCoupon;
import com.ruoyi.merchant.domain.PmsSkuInfo;
import com.ruoyi.merchant.service.MerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 28173
 * #Description MerchantController
 * #Date: 2025/1/13 22:00
 */
@RestController
@RequestMapping("/merchant")
public class MerchantController extends BaseController {
    @Autowired
    private MerchantService merchantService;

    /**
     * 商家所有的商品列表
     * @return
     */
    @GetMapping("/productList")
    public AjaxResult productList(){
        List<PmsSkuInfo> pmsSkuInfoList = merchantService.productList();
        return AjaxResult.success(pmsSkuInfoList);
    }

    /**
     * 获取选中的商品列表
     * @param ids
     * @return
     */
    @GetMapping("/getProductList/{ids}")
    public AjaxResult getProductList(@PathVariable Long[] ids) {
        List<PmsSkuInfo> pmsSkuInfoList = merchantService.getProductList(ids);
        System.out.println(ids);
        return AjaxResult.success(pmsSkuInfoList);
    }
}
